%% Carbon Taxes Around the World: Cooperation, Strategic Interactions, and Spillovers
% IMF Economic Review
% Alessandro Moro and Valerio Nispi Landi
% Replication files
% This file obtains the IRFs for Figure 4


clc; clear all; close all;



console
SAVE=1;
load sim_psi0 
load sim_psi05
load sim_psi1
ne=[ne_psi0; ne_psi05; ne_psi1];
sp=[sp_psi0; sp_psi05; sp_psi1];

for NE=[0,1]
for psiX=[0,0.5,1]


%%
if psiX==0 && NE==1
digamma=ne(1,1);  
digammaz=ne(1,2); 
save digs digamma digammaz
console_final_opt
if flag<1
disp(['Computation fails in console']);
return
end
BASE=0;
dynare climate
if oo_.deterministic_simulation.status ~= 1
disp(['Computation fails in Dynare']);
return
end
if SAVE==1
muW_ne_psi0=muW;
xs_ne_psi0=xs;
temps_ne_psi0=temps;
price_ne_psi0=prices;
priceW_ne_psi0=priceWs;
gdps_ne_psi0=gdps;
gdpzs_ne_psi0=gdpzs;
W_ne_psi0=W;
Wz_ne_psi0=Wz;

save irf_ne_psi0 muW_ne_psi0 xs_ne_psi0 temps_ne_psi0 price_ne_psi0 priceW_ne_psi0 gdps_ne_psi0...
    gdpzs_ne_psi0 Wz_ne_psi0 W_ne_psi0
end    


%%
elseif psiX==0 && NE==0
digamma=sp(1,1);  
digammaz=sp(1,2); 
save digs digamma digammaz
console_final_opt
if flag<1
disp(['Computation fails in console']);
return
end
BASE=0;
dynare climate
if oo_.deterministic_simulation.status ~= 1
disp(['Computation fails in Dynare']);
return
end
if SAVE==1
muW_sp_psi0=muW;
xs_sp_psi0=xs;
temps_sp_psi0=temps;
price_sp_psi0=prices;
priceW_sp_psi0=priceWs;
gdps_sp_psi0=gdps;
gdpzs_sp_psi0=gdpzs;
W_sp_psi0=W;
Wz_sp_psi0=Wz;

save irf_sp_psi0 muW_sp_psi0 xs_sp_psi0 temps_sp_psi0 price_sp_psi0 priceW_sp_psi0...
    gdps_sp_psi0 gdpzs_sp_psi0 Wz_sp_psi0 W_sp_psi0
elseif psiX==0.5 && NE==1 
end    
%%
elseif psiX==0.5 && NE==1
digamma=ne(2,1);  
digammaz=ne(2,2); 
save digs digamma digammaz
console_final_opt
if flag<1
disp(['Computation fails in console']);
return
end
BASE=0;
dynare climate
if oo_.deterministic_simulation.status ~= 1
disp(['Computation fails in Dynare']);
return
end
if SAVE==1
muW_ne_psi05=muW;
xs_ne_psi05=xs;
temps_ne_psi05=temps;
price_ne_psi05=prices;
priceW_ne_psi05=priceWs;
gdps_ne_psi05=gdps;
gdpzs_ne_psi05=gdpzs;
W_ne_psi05=W;
Wz_ne_psi05=Wz;
save irf_ne_psi05 muW_ne_psi05 xs_ne_psi05 temps_ne_psi05 price_ne_psi05...
    priceW_ne_psi05 gdps_ne_psi05 gdpzs_ne_psi05 Wz_ne_psi05 W_ne_psi05
end
%%
elseif psiX==0.5 && NE==0
digamma=sp(2,1);  
digammaz=sp(2,2); 
save digs digamma digammaz
console_final_opt
if flag<1
disp(['Computation fails in console']);
return
end
BASE=0;
dynare climate
if oo_.deterministic_simulation.status ~= 1
disp(['Computation fails in Dynare']);
return
end
if SAVE==1
muW_sp_psi05=muW;
xs_sp_psi05=xs;
temps_sp_psi05=temps;
price_sp_psi05=prices;
priceW_sp_psi05=priceWs;
gdps_sp_psi05=gdps;
gdpzs_sp_psi05=gdpzs;
W_sp_psi05=W;
Wz_sp_psi05=Wz;

save irf_sp_psi05 muW_sp_psi05 xs_sp_psi05 temps_sp_psi05 price_sp_psi05...
     priceW_sp_psi05 gdps_sp_psi05 gdpzs_sp_psi05 Wz_sp_psi05 W_sp_psi05
end    
%%
elseif psiX==1 && NE==1
digamma=ne(3,1);  
digammaz=ne(3,2); 
save digs digamma digammaz
console_final_opt
if flag<1
disp(['Computation fails in console']);
return
end
BASE=0;
dynare climate
if oo_.deterministic_simulation.status ~= 1
disp(['Computation fails in Dynare']);
return
end

if SAVE==1
muW_ne_psi1=muW;
xs_ne_psi1=xs;
temps_ne_psi1=temps;
price_ne_psi1=prices;
priceW_ne_psi1=priceWs;
gdps_ne_psi1=gdps;
gdpzs_ne_psi1=gdpzs;
W_ne_psi1=W;
Wz_ne_psi1=Wz;
save irf_ne_psi1 muW_ne_psi1 xs_ne_psi1 temps_ne_psi1 price_ne_psi1...
        priceW_ne_psi1 gdps_ne_psi1 gdpzs_ne_psi1 Wz_ne_psi1 W_ne_psi1
end    

%%
elseif psiX==1 && NE==0
digamma=sp(3,1);  
digammaz=sp(3,2);
save digs digamma digammaz
console_final_opt
if flag<1
disp(['Computation fails in console']);
return
end
BASE=0;
dynare climate
if oo_.deterministic_simulation.status ~= 1
disp(['Computation fails in Dynare']);
return
end
if SAVE==1
muW_sp_psi1=muW;
xs_sp_psi1=xs;
temps_sp_psi1=temps;
price_sp_psi1=prices;
priceW_sp_psi1=priceWs;
gdps_sp_psi1=gdps;
gdpzs_sp_psi1=gdpzs;
W_sp_psi1=W;
Wz_sp_psi1=Wz;
save irf_sp_psi1 muW_sp_psi1 xs_sp_psi1 temps_sp_psi1 price_sp_psi1...
      priceW_sp_psi1 gdps_sp_psi1 gdpzs_sp_psi1 Wz_sp_psi1 W_sp_psi1
end    
end
end
end


 


